Analyzes the frequency content of the waveform store in vector. Returns a vector where nth element represents the amplitude of the nth frequency. Note that the input vector length must be (expt 2 n), like 64, 128, 256, 512. The analyze-spectrum output can directly be drawn in visualizer showing you the amounts of each frequency.
(setq spectrum
(analyze-spectrum
(gen-fourier
'(1 3 5) ; frequencies 1, 2 and 3
'(1 0.5 0.25) ; amplitudes - also contours allowed
'(0 0 0) ; initial phases
512)))
(aref spectrum 1) ; frequency 1
--> 1.0
(aref spectrum 2) ; frequency 2
--> 0.0
(aref spectrum 3) ; frequency 3
--> 0.5
(aref spectrum 4) ; frequency 4
--> 0.0
(aref spectrum 5) ; frequency 5
--> 0.25
If you are having a vector whose length is not (expt 2 n) then use vector-quantize before applying analyze-spectrum. You can get interesting monotoneus melodies from symbol fractal spectrum. Visualize the following.